home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nivb / bind.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-07  |  12.1 KB  |  329 lines

  1. VERSION 2.00
  2. Begin Form BindForm 
  3.    Caption         =   "Bindery Services Test"
  4.    ClientHeight    =   4155
  5.    ClientLeft      =   990
  6.    ClientTop       =   1320
  7.    ClientWidth     =   8895
  8.    Height          =   4560
  9.    Left            =   930
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4155
  13.    ScaleWidth      =   8895
  14.    Top             =   975
  15.    Width           =   9015
  16.    Begin CommandButton CloseButton 
  17.       Caption         =   "&OK"
  18.       Height          =   372
  19.       Left            =   6720
  20.       TabIndex        =   11
  21.       Top             =   3600
  22.       Width           =   1332
  23.    End
  24.    Begin ComboBox ServerNameBox 
  25.       Height          =   288
  26.       Left            =   2400
  27.       Sorted          =   -1  'True
  28.       TabIndex        =   0
  29.       Text            =   "ServerNameBox"
  30.       Top             =   3600
  31.       Width           =   2412
  32.    End
  33.    Begin ListBox BinderyObjList 
  34.       FontBold        =   -1  'True
  35.       FontItalic      =   0   'False
  36.       FontName        =   "Courier"
  37.       FontSize        =   9.75
  38.       FontStrikethru  =   0   'False
  39.       FontUnderline   =   0   'False
  40.       Height          =   2370
  41.       Left            =   240
  42.       Sorted          =   -1  'True
  43.       TabIndex        =   9
  44.       Top             =   840
  45.       Width           =   8460
  46.    End
  47.    Begin Label Label10 
  48.       Caption         =   "File Server:"
  49.       Height          =   252
  50.       Left            =   1200
  51.       TabIndex        =   10
  52.       Top             =   3600
  53.       Width           =   1092
  54.    End
  55.    Begin Label Label1 
  56.       Caption         =   "Add Props"
  57.       Height          =   252
  58.       Left            =   7560
  59.       TabIndex        =   8
  60.       Top             =   480
  61.       Width           =   972
  62.    End
  63.    Begin Label Label7 
  64.       Caption         =   "Scan"
  65.       Height          =   252
  66.       Left            =   7080
  67.       TabIndex        =   7
  68.       Top             =   480
  69.       Width           =   492
  70.    End
  71.    Begin Label Label9 
  72.       BorderStyle     =   1  'Fixed Single
  73.       Height          =   12
  74.       Left            =   7080
  75.       TabIndex        =   12
  76.       Top             =   360
  77.       Width           =   1452
  78.    End
  79.    Begin Label Label4 
  80.       Caption         =   "Object ID"
  81.       Height          =   252
  82.       Left            =   4920
  83.       TabIndex        =   6
  84.       Top             =   360
  85.       Width           =   852
  86.    End
  87.    Begin Label Label3 
  88.       Caption         =   "Object Type"
  89.       Height          =   252
  90.       Left            =   3120
  91.       TabIndex        =   5
  92.       Top             =   360
  93.       Width           =   1092
  94.    End
  95.    Begin Label Label2 
  96.       Caption         =   "Object Name"
  97.       Height          =   252
  98.       Left            =   312
  99.       TabIndex        =   4
  100.       Top             =   372
  101.       Width           =   1212
  102.    End
  103.    Begin Label Label6 
  104.       Alignment       =   2  'Center
  105.       Caption         =   "Dyn/ Stat"
  106.       Height          =   372
  107.       Left            =   6384
  108.       TabIndex        =   3
  109.       Top             =   252
  110.       Width           =   612
  111.    End
  112.    Begin Label Label5 
  113.       Alignment       =   2  'Center
  114.       Caption         =   "Has Props"
  115.       Height          =   372
  116.       Left            =   5880
  117.       TabIndex        =   2
  118.       Top             =   240
  119.       Width           =   612
  120.    End
  121.    Begin Label Label8 
  122.       Caption         =   "Access Control"
  123.       Height          =   252
  124.       Left            =   7140
  125.       TabIndex        =   1
  126.       Top             =   84
  127.       Width           =   1332
  128.    End
  129. Sub CloseButton_Click ()
  130.     Unload BindForm
  131. End Sub
  132. Sub Form_Load ()
  133.     For connID% = 1 To 8
  134.         fileServerName$ = String$(48, 0)
  135.         If (IsConnectionIDInUse(connID%) = 1) Then
  136.             GetFileServerName connID%, fileServerName$
  137.             ServerNameBox.AddItem fileServerName$
  138.         End If
  139.     Next connID%
  140.     'get name of default file server for combo box
  141.     fileServerName$ = GetDefaultFileServerName()
  142.     ServerNameBox.Text = fileServerName$
  143.     Main.MousePointer = 0
  144. End Sub
  145. Sub Form_Unload (Cancel As Integer)
  146.     SetPreferredConnectionID (originalPrefConnID%)
  147. End Sub
  148. Sub ScanBindery ()
  149.     Dim objectType As String * 6
  150.     BinderyObjList.Clear
  151.     oID& = -1   'initialize object ID to -1 for first call to ScanBinderyObject
  152.     Do
  153.         oName$ = String$(48, 0)
  154.         ccode% = ScanBinderyObject("*", OT_WILD, oID&, oName$, oType%, oHasProps%, oFlag%, oSecurity%)
  155.         If (ccode% = SUCCESSFUL) Then
  156.             
  157.             'take all characters of object name up to terminating null
  158.             out$ = Left$(oName$, InStr(oName$, Chr$(0)) - 1)
  159.             'then take first 20 chars
  160.             out$ = Left$(out$, 20)
  161.             'pad with spaces
  162.             out$ = out$ + Space$(22 - Len(out$))
  163.             
  164.             Select Case oType%
  165.                 Case OT_USER
  166.                     out$ = out$ + "User            "
  167.                 Case OT_USER_GROUP
  168.                     out$ = out$ + "User Group      "
  169.                 Case OT_PRINT_QUEUE
  170.                     out$ = out$ + "Print Queue     "
  171.                 Case OT_FILE_SERVER
  172.                     out$ = out$ + "File Server     "
  173.                 Case OT_JOB_SERVER
  174.                     out$ = out$ + "Job Server      "
  175.                 Case OT_GATEWAY
  176.                     out$ = out$ + "Gateway         "
  177.                 Case OT_PRINT_SERVER
  178.                     out$ = out$ + "Print Server    "
  179.                 Case OT_ARCHIVE_QUEUE
  180.                     out$ = out$ + "Archive Queue   "
  181.                 Case OT_ARCHIVE_SERVER
  182.                     out$ = out$ + "Archive Server  "
  183.                 Case OT_JOB_QUEUE
  184.                     out$ = out$ + "Job Queue       "
  185.                 Case OT_ADMINISTRATION
  186.                     out$ = out$ + "Administration  "
  187.                 Case OT_NAS_SNA_GATEWAY
  188.                     out$ = out$ + "NAS SNA Gateway "
  189.                 Case OT_NACS
  190.                     out$ = out$ + "NACS            "
  191.                 Case OT_REMOTE_BRIDGE_SERVER
  192.                     out$ = out$ + "Rem Bridge Serv "
  193.                 Case OT_BRIDGE_SERVER
  194.                     out$ = out$ + "Bridge Server   "
  195.                 Case OT_TCPIP_GATEWAY
  196.                     out$ = out$ + "TCP/IP Gateway  "
  197.                 Case OT_GATE
  198.                     out$ = out$ + "Gateway         "
  199.                 Case OT_TIME_SYNCHRONIZATION_SERVER
  200.                     out$ = out$ + "Time Synch Serv "
  201.                 Case OT_ARCHIVE_SRV
  202.                     out$ = out$ + "Archive Server  "
  203.                 Case OT_ADVERTISING_PRINT_SERVER
  204.                     out$ = out$ + "Adver Print Srv "
  205.                 Case OT_BTRIEVE_VAP_NLM_5XX
  206.                     out$ = out$ + "Btrieve v5.xx   "
  207.                 Case OT_SQL_VAP_NLM
  208.                     out$ = out$ + "SQL VAP/NLM     "
  209.                 Case OT_XTREE_NETWORK
  210.                     out$ = out$ + "Xtree Net Ver   "
  211.                 Case OT_BTRIEVE_VAP_NLM_4XX
  212.                     out$ = out$ + "Btrieve v4.xx   "
  213.                 Case OT_APPLETALK_GATEWAY
  214.                     out$ = out$ + "AppleTalk Gatew "
  215.                 Case OT_X25_GATEWAY
  216.                     out$ = out$ + "X.25 Gateway    "
  217.                 Case OT_WAN_COPY
  218.                     out$ = out$ + "WAN Copy        "
  219.                 Case OT_TES_NETWARE_VMS
  220.                     out$ = out$ + "TES-NetWare VMS "
  221.                 Case OT_NETWARE_ACCESS_SERVER
  222.                     out$ = out$ + "NW Access Serv  "
  223.                 Case OT_PORTABLE_NETWARE
  224.                     out$ = out$ + "Portable NetW   "
  225.                 Case OT_COMPAQ_IDA_STATUS_MONITOR
  226.                     out$ = out$ + "Compaq IDA Stat "
  227.                 Case OT_NETWARE_386_SERVER
  228.                     out$ = out$ + "NetWare 386 Srv "
  229.                 Case OT_CSA_MUX
  230.                     out$ = out$ + "CSA MUX         "
  231.                 Case OT_CSA_LCA
  232.                     out$ = out$ + "CSA LCA         "
  233.                 Case OT_CSA_CM
  234.                     out$ = out$ + "CSA CM          "
  235.                 Case OT_CSA_SMA
  236.                     out$ = out$ + "CSA SMA         "
  237.                 Case OT_CSA_DBA
  238.                     out$ = out$ + "CSA DBA         "
  239.                 Case OT_CSA_NMA
  240.                     out$ = out$ + "CSA NMA         "
  241.                 Case OT_CSA_SSA
  242.                     out$ = out$ + "CSA SSA         "
  243.                 Case OT_CSA_STATUS
  244.                     out$ = out$ + "CSA STATUS      "
  245.                 Case OT_CSA_APPC
  246.                     out$ = out$ + "CSA APPC        "
  247.                 Case OT_SNA_TEST
  248.                     out$ = out$ + "SNA TEST        "
  249.                 Case OT_CSA_TRACE
  250.                     out$ = out$ + "CSA TRACE       "
  251.                 Case OT_COMMUNICATIONS_EXECUTIVE
  252.                     out$ = out$ + "Comm Executive  "
  253.                 Case OT_NNS_DOMAIN
  254.                     out$ = out$ + "NNS Domain      "
  255.                 Case OT_NNS_PROFILE
  256.                     out$ = out$ + "NNS Profile     "
  257.                 Case OT_NNS_QUEUE
  258.                     out$ = out$ + "NNS Queue       "
  259.                 Case OT_WORDPERFECT_NETWORK
  260.                     out$ = out$ + "WordPerfect Net "
  261.                 Case Else
  262.                     objectType = Str$(oType%)
  263.                     out$ = out$ + "[" + objectType + "]" + "        "
  264.             End Select
  265.             'format the bindery object ID as 8 hex digits, with leading zeros
  266.             out$ = out$ + String$((8 - Len(Hex$(oID&))), "0") + Hex$(oID&) + "  "
  267.             'does the bindery object have properties?
  268.             If oHasProps% = 0 Then
  269.                 out$ = out$ + "N   "
  270.             Else
  271.                 out$ = out$ + "Y   "
  272.             End If
  273.             'is the bindery object static or dynamic?
  274.             If oFlag% = 0 Then
  275.                 out$ = out$ + "Stat  "
  276.             Else
  277.                 out$ = out$ + "Dyn   "
  278.             End If
  279.             'who can scan for the bindery object,
  280.             'and who can add properties?
  281.             Select Case (oSecurity% And &HF)
  282.                 Case &H0
  283.                     out$ = out$ + "Any  "   'anyone can scan for the object
  284.                 Case &H1
  285.                     out$ = out$ + "Log  "   'any logged user can scan
  286.                 Case &H2
  287.                     out$ = out$ + "Obj  "   'only the object can scan for itself
  288.                 Case &H3
  289.                     out$ = out$ + "Sup  "   'only the supervisor can scan
  290.                 Case &H4
  291.                     out$ = out$ + "OS   "   'only the operating system can scan
  292.             End Select
  293.             
  294.             Select Case (oSecurity% And &HF0)
  295.                 Case &H0
  296.                     out$ = out$ + "Any  "   'anyone can add properties to the object
  297.                 Case &H10
  298.                     out$ = out$ + "Log  "   'any logged user can add properties
  299.                 Case &H20
  300.                     out$ = out$ + "Obj  "   'only the object can add props to itself
  301.                 Case &H30
  302.                     out$ = out$ + "Sup  "   'only the supervisor can add props
  303.                 Case &H40
  304.                     out$ = out$ + "OS   "   'only the OS can add properties
  305.             End Select
  306.             
  307.             'finally, add one more entry to the list
  308.             'of bindery objects
  309.             BinderyObjList.AddItem out$
  310.         End If
  311.     Loop Until ccode%
  312. End Sub
  313. Sub ServerNameBox_Change ()
  314.     prefServer$ = ServerNameBox.Text
  315.     ccode% = GetConnectionID(prefServer$, connID%)
  316.     If (ccode% = SUCCESSFUL) Then
  317.         SetPreferredConnectionID (connID%)  'tell which file server to send
  318.                                             'requests to
  319.         Screen.MousePointer = 11
  320.         ScanBindery                         'then go scan its bindery
  321.         Screen.MousePointer = 0
  322.     Else
  323.         MsgBox "Unable to get connection ID of server " + prefServer$, MB_OK, "Error"
  324.     End If
  325. End Sub
  326. Sub ServerNameBox_Click ()
  327.     ServerNameBox_Change
  328. End Sub
  329.